package flextv.display.command {

import com.adobe.cairngorm.commands.ICommand;
import com.adobe.cairngorm.control.CairngormEvent;

import flextv.core.event.PlayItemEvent;
import flextv.core.logic.Logger;
import flextv.core.vo.IPlayable;
import flextv.display.logic.DisplayModel;

import mx.logging.ILogger;

public class PlayItemCommand implements ICommand {
	
	private static const LOG: ILogger = Logger.getLog(PlayItemCommand);
	
	public function PlayItemCommand() {
	}

	public function execute(_event: CairngormEvent): void {
		const event: PlayItemEvent = _event as PlayItemEvent;
		LOG.debug("Executing [event=" + event + "].");
		
		const item: IPlayable = event.item;
		
		// if ViewModel.instance.playItem == item ... nothing happens, because setter-binding wont fire
		// ViewModel.instance.playItem = null;
		DisplayModel.instance.playItem = item;
			
	}
	
}
}